--
-- PostgreSQL database dump
--

-- Dumped from database version 16.3
-- Dumped by pg_dump version 16.3

-- Started on 2024-06-13 03:58:41

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 7 (class 2615 OID 24830)
-- Name: identity; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA identity;


ALTER SCHEMA identity OWNER TO postgres;

--
-- TOC entry 6 (class 2615 OID 24829)
-- Name: retail; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA retail;


ALTER SCHEMA retail OWNER TO postgres;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 219 (class 1259 OID 24904)
-- Name: users; Type: TABLE; Schema: identity; Owner: postgres
--

CREATE TABLE identity.users (
    "Id" uuid NOT NULL,
    "Name" character varying(255) NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE identity.users OWNER TO postgres;

--
-- TOC entry 217 (class 1259 OID 24824)
-- Name: __EFMigrationsHistory; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public."__EFMigrationsHistory" (
    "MigrationId" character varying(150) NOT NULL,
    "ProductVersion" character varying(32) NOT NULL
);


ALTER TABLE public."__EFMigrationsHistory" OWNER TO postgres;

--
-- TOC entry 218 (class 1259 OID 24899)
-- Name: brands; Type: TABLE; Schema: retail; Owner: postgres
--

CREATE TABLE retail.brands (
    "Id" uuid NOT NULL,
    "Name" character varying(255) NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE retail.brands OWNER TO postgres;

--
-- TOC entry 220 (class 1259 OID 24909)
-- Name: models; Type: TABLE; Schema: retail; Owner: postgres
--

CREATE TABLE retail.models (
    "Id" uuid NOT NULL,
    "Name" character varying(255) NOT NULL,
    "BrandId" uuid NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE retail.models OWNER TO postgres;

--
-- TOC entry 222 (class 1259 OID 24929)
-- Name: prices; Type: TABLE; Schema: retail; Owner: postgres
--

CREATE TABLE retail.prices (
    "Id" uuid NOT NULL,
    "Value" numeric NOT NULL,
    "StartDate" timestamp with time zone NOT NULL,
    "EndDate" timestamp with time zone,
    "VehicleId" uuid NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE retail.prices OWNER TO postgres;

--
-- TOC entry 223 (class 1259 OID 24941)
-- Name: reservations; Type: TABLE; Schema: retail; Owner: postgres
--

CREATE TABLE retail.reservations (
    "Id" uuid NOT NULL,
    "StartDate" timestamp with time zone NOT NULL,
    "EndDate" timestamp with time zone NOT NULL,
    "VehicleId" uuid NOT NULL,
    "UserId" uuid NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE retail.reservations OWNER TO postgres;

--
-- TOC entry 221 (class 1259 OID 24919)
-- Name: vehicles; Type: TABLE; Schema: retail; Owner: postgres
--

CREATE TABLE retail.vehicles (
    "Id" uuid NOT NULL,
    "ReleaseYear" integer NOT NULL,
    "Mileage" integer NOT NULL,
    "Engine_Volume" double precision NOT NULL,
    "Engine_Power" integer NOT NULL,
    "Engine_Type" integer NOT NULL,
    "ModelId" uuid NOT NULL,
    "IsDeleted" boolean NOT NULL,
    "CreatedAt" timestamp with time zone NOT NULL
);


ALTER TABLE retail.vehicles OWNER TO postgres;

--
-- TOC entry 4882 (class 0 OID 24904)
-- Dependencies: 219
-- Data for Name: users; Type: TABLE DATA; Schema: identity; Owner: postgres
--

COPY identity.users ("Id", "Name", "IsDeleted", "CreatedAt") FROM stdin;
5a6d26d5-14aa-4538-989b-8119559fff0c	Roman	f	2024-06-12 23:10:11.676585+03
\.


--
-- TOC entry 4880 (class 0 OID 24824)
-- Dependencies: 217
-- Data for Name: __EFMigrationsHistory; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public."__EFMigrationsHistory" ("MigrationId", "ProductVersion") FROM stdin;
20240612200827_Initial	8.0.6
\.


--
-- TOC entry 4881 (class 0 OID 24899)
-- Dependencies: 218
-- Data for Name: brands; Type: TABLE DATA; Schema: retail; Owner: postgres
--

COPY retail.brands ("Id", "Name", "IsDeleted", "CreatedAt") FROM stdin;
900dd866-b55b-42ee-a5c5-d86a49e47306	Lada (ВАЗ)	f	2024-06-12 23:10:11.676585+03
54584988-e6b8-4b62-b1bd-0d119fe55849	Mercedes-Benz	f	2024-06-12 23:10:40.758836+03
f462e600-fb85-4cf1-9964-faa60302421c	BMW	f	2024-06-12 23:10:44.850848+03
6c0a7ae0-1ee4-427f-b43f-37aba6f3e858	Renault	f	2024-06-12 23:10:49.164293+03
\.


--
-- TOC entry 4883 (class 0 OID 24909)
-- Dependencies: 220
-- Data for Name: models; Type: TABLE DATA; Schema: retail; Owner: postgres
--

COPY retail.models ("Id", "Name", "BrandId", "IsDeleted", "CreatedAt") FROM stdin;
ff8af92e-3efc-4f02-bddb-d79fd4ecaca5	Sandero	6c0a7ae0-1ee4-427f-b43f-37aba6f3e858	f	2024-06-12 23:13:48.349823+03
d1d4eb88-ea85-4eb0-bd69-14440d7735c6	Logan	6c0a7ae0-1ee4-427f-b43f-37aba6f3e858	f	2024-06-12 23:13:53.746157+03
379e5638-f552-44e5-b1ce-3f44b4302374	Granta	900dd866-b55b-42ee-a5c5-d86a49e47306	f	2024-06-13 03:31:47.61446+03
c00b7554-eeda-49ee-9c3a-725e741ffa48	Vesta	900dd866-b55b-42ee-a5c5-d86a49e47306	f	2024-06-13 03:31:52.803913+03
4e8f8f14-42f9-4d8f-ab20-8ba58240f0df	Priora	900dd866-b55b-42ee-a5c5-d86a49e47306	f	2024-06-13 03:32:18.054518+03
a8489bd6-4772-43ad-84e3-33b7b973e008	GLE	54584988-e6b8-4b62-b1bd-0d119fe55849	f	2024-06-13 03:34:46.324406+03
754d1cd0-eff3-4b9f-8269-ef674fa63ecb	CLA	54584988-e6b8-4b62-b1bd-0d119fe55849	f	2024-06-13 03:34:51.046286+03
3632d4f7-c13e-4309-a87b-f77409d752cf	X5	f462e600-fb85-4cf1-9964-faa60302421c	f	2024-06-13 03:35:31.770953+03
25ac38c5-2643-46c2-a687-d1026d97a3c4	X7	f462e600-fb85-4cf1-9964-faa60302421c	f	2024-06-13 03:35:35.136223+03
ec490c20-38be-46fa-9c84-7a653b5943bd	Series 3	f462e600-fb85-4cf1-9964-faa60302421c	f	2024-06-13 03:35:44.328024+03
9647ae46-f0aa-42e1-9cc5-813af7462a95	Series 5	f462e600-fb85-4cf1-9964-faa60302421c	f	2024-06-13 03:35:45.783517+03
8a6a4e3e-faf1-4258-9c0d-0b9e50f87567	Series 7	f462e600-fb85-4cf1-9964-faa60302421c	f	2024-06-13 03:35:48.139389+03
\.


--
-- TOC entry 4885 (class 0 OID 24929)
-- Dependencies: 222
-- Data for Name: prices; Type: TABLE DATA; Schema: retail; Owner: postgres
--

COPY retail.prices ("Id", "Value", "StartDate", "EndDate", "VehicleId", "IsDeleted", "CreatedAt") FROM stdin;
cf0d50c2-fb1e-40f9-98dc-4c6553fe689d	830000	2024-06-08 23:48:01.957761+03	\N	2ab17204-6f05-43ad-9376-d88a614ec98f	f	2024-06-08 23:48:01.957695+03
cd9646e8-bf02-4178-9f4e-ebe7132b63f0	417000	2024-06-10 23:54:52.984243+03	2024-06-13 00:37:02.484264+03	9bdda824-8b05-4d40-a3ac-e51237edd5cb	f	2024-06-10 23:54:52.984162+03
2735a932-6ee5-4678-aebb-5df5d1704815	398000	2024-06-13 00:37:02.484902+03	\N	9bdda824-8b05-4d40-a3ac-e51237edd5cb	f	2024-06-13 00:37:02.484732+03
8a2d1bdd-ccb1-4d39-8dc8-13ad9e9e7ae9	1100000	2024-06-13 03:36:51.839746+03	\N	6c84bf78-b8bc-4f3c-b23a-e2bb2d508af2	f	2024-06-13 03:36:51.839703+03
b40425bd-b228-46fa-b9f9-6a7fcd1a2001	1002000	2024-06-13 03:41:01.265647+03	\N	93dc1e0b-8a97-4ea1-9144-b718ef2a50c1	f	2024-06-13 03:41:01.265603+03
2caa17cc-458b-4309-923c-8f10fdea3c0d	960000	2024-06-13 03:43:28.99581+03	\N	c7022609-c249-4361-94fd-a979860fcefe	f	2024-06-13 03:43:28.995765+03
6ad0ba41-86fb-4313-9b47-915413f6c0d7	940000	2024-06-13 03:44:13.280476+03	\N	c2db5066-d896-4371-aefc-dbbeefe8951a	f	2024-06-13 03:44:13.280475+03
48c073f8-4e0e-40a9-b5ef-e7eb1f7ed0d7	850000	2024-06-13 03:44:39.124918+03	2024-06-13 03:45:14.210637+03	7ed66a6b-4ee0-45b7-9992-6be953fae8d5	f	2024-06-13 03:44:39.124918+03
ec54ad42-85c1-46be-9748-ad1ef2e1365e	820000	2024-06-13 03:45:14.210693+03	\N	7ed66a6b-4ee0-45b7-9992-6be953fae8d5	f	2024-06-13 03:45:14.210693+03
\.


--
-- TOC entry 4886 (class 0 OID 24941)
-- Dependencies: 223
-- Data for Name: reservations; Type: TABLE DATA; Schema: retail; Owner: postgres
--

COPY retail.reservations ("Id", "StartDate", "EndDate", "VehicleId", "UserId", "IsDeleted", "CreatedAt") FROM stdin;
4a6a1677-c0f0-4f9a-9e88-e5c5bdd9647c	2024-06-13 02:56:35.530464+03	2024-06-13 03:10:07.890511+03	2ab17204-6f05-43ad-9376-d88a614ec98f	5a6d26d5-14aa-4538-989b-8119559fff0c	t	2024-06-13 02:56:35.530409+03
3a8bbb8c-8b90-44e0-a49d-579ed9186e49	2024-06-13 03:49:56.003724+03	2024-06-23 03:00:00+03	93dc1e0b-8a97-4ea1-9144-b718ef2a50c1	5a6d26d5-14aa-4538-989b-8119559fff0c	f	2024-06-13 03:49:56.003564+03
\.


--
-- TOC entry 4884 (class 0 OID 24919)
-- Dependencies: 221
-- Data for Name: vehicles; Type: TABLE DATA; Schema: retail; Owner: postgres
--

COPY retail.vehicles ("Id", "ReleaseYear", "Mileage", "Engine_Volume", "Engine_Power", "Engine_Type", "ModelId", "IsDeleted", "CreatedAt") FROM stdin;
2ab17204-6f05-43ad-9376-d88a614ec98f	2019	203000	1.6	113	0	d1d4eb88-ea85-4eb0-bd69-14440d7735c6	f	2024-06-12 23:48:01.957193+03
9bdda824-8b05-4d40-a3ac-e51237edd5cb	2006	150500	1.6	87	0	d1d4eb88-ea85-4eb0-bd69-14440d7735c6	f	2024-06-12 23:54:38.761318+03
93dc1e0b-8a97-4ea1-9144-b718ef2a50c1	2024	100	1.6	90	0	379e5638-f552-44e5-b1ce-3f44b4302374	f	2024-06-13 03:41:01.265224+03
c7022609-c249-4361-94fd-a979860fcefe	2022	41000	1.6	90	0	379e5638-f552-44e5-b1ce-3f44b4302374	f	2024-06-13 03:43:28.995362+03
c2db5066-d896-4371-aefc-dbbeefe8951a	2018	109000	1.6	98	0	379e5638-f552-44e5-b1ce-3f44b4302374	f	2024-06-13 03:44:13.280472+03
7ed66a6b-4ee0-45b7-9992-6be953fae8d5	2020	55000	1.6	106	0	379e5638-f552-44e5-b1ce-3f44b4302374	f	2024-06-13 03:44:39.124917+03
6c84bf78-b8bc-4f3c-b23a-e2bb2d508af2	2007	160000	4	306	0	8a6a4e3e-faf1-4258-9c0d-0b9e50f87567	t	2024-06-13 03:36:51.839332+03
\.


--
-- TOC entry 4718 (class 2606 OID 24908)
-- Name: users PK_users; Type: CONSTRAINT; Schema: identity; Owner: postgres
--

ALTER TABLE ONLY identity.users
    ADD CONSTRAINT "PK_users" PRIMARY KEY ("Id");


--
-- TOC entry 4714 (class 2606 OID 24828)
-- Name: __EFMigrationsHistory PK___EFMigrationsHistory; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public."__EFMigrationsHistory"
    ADD CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId");


--
-- TOC entry 4716 (class 2606 OID 24903)
-- Name: brands PK_brands; Type: CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.brands
    ADD CONSTRAINT "PK_brands" PRIMARY KEY ("Id");


--
-- TOC entry 4721 (class 2606 OID 24913)
-- Name: models PK_models; Type: CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.models
    ADD CONSTRAINT "PK_models" PRIMARY KEY ("Id");


--
-- TOC entry 4727 (class 2606 OID 24935)
-- Name: prices PK_prices; Type: CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.prices
    ADD CONSTRAINT "PK_prices" PRIMARY KEY ("Id");


--
-- TOC entry 4731 (class 2606 OID 24945)
-- Name: reservations PK_reservations; Type: CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.reservations
    ADD CONSTRAINT "PK_reservations" PRIMARY KEY ("Id");


--
-- TOC entry 4724 (class 2606 OID 24923)
-- Name: vehicles PK_vehicles; Type: CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.vehicles
    ADD CONSTRAINT "PK_vehicles" PRIMARY KEY ("Id");


--
-- TOC entry 4719 (class 1259 OID 24956)
-- Name: IX_models_BrandId; Type: INDEX; Schema: retail; Owner: postgres
--

CREATE INDEX "IX_models_BrandId" ON retail.models USING btree ("BrandId");


--
-- TOC entry 4725 (class 1259 OID 24957)
-- Name: IX_prices_VehicleId; Type: INDEX; Schema: retail; Owner: postgres
--

CREATE INDEX "IX_prices_VehicleId" ON retail.prices USING btree ("VehicleId");


--
-- TOC entry 4728 (class 1259 OID 24958)
-- Name: IX_reservations_UserId; Type: INDEX; Schema: retail; Owner: postgres
--

CREATE INDEX "IX_reservations_UserId" ON retail.reservations USING btree ("UserId");


--
-- TOC entry 4729 (class 1259 OID 24959)
-- Name: IX_reservations_VehicleId; Type: INDEX; Schema: retail; Owner: postgres
--

CREATE INDEX "IX_reservations_VehicleId" ON retail.reservations USING btree ("VehicleId");


--
-- TOC entry 4722 (class 1259 OID 24960)
-- Name: IX_vehicles_ModelId; Type: INDEX; Schema: retail; Owner: postgres
--

CREATE INDEX "IX_vehicles_ModelId" ON retail.vehicles USING btree ("ModelId");


--
-- TOC entry 4732 (class 2606 OID 24914)
-- Name: models FK_models_brands_BrandId; Type: FK CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.models
    ADD CONSTRAINT "FK_models_brands_BrandId" FOREIGN KEY ("BrandId") REFERENCES retail.brands("Id") ON DELETE CASCADE;


--
-- TOC entry 4734 (class 2606 OID 24936)
-- Name: prices FK_prices_vehicles_VehicleId; Type: FK CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.prices
    ADD CONSTRAINT "FK_prices_vehicles_VehicleId" FOREIGN KEY ("VehicleId") REFERENCES retail.vehicles("Id") ON DELETE CASCADE;


--
-- TOC entry 4735 (class 2606 OID 24946)
-- Name: reservations FK_reservations_users_UserId; Type: FK CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.reservations
    ADD CONSTRAINT "FK_reservations_users_UserId" FOREIGN KEY ("UserId") REFERENCES identity.users("Id") ON DELETE CASCADE;


--
-- TOC entry 4736 (class 2606 OID 24951)
-- Name: reservations FK_reservations_vehicles_VehicleId; Type: FK CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.reservations
    ADD CONSTRAINT "FK_reservations_vehicles_VehicleId" FOREIGN KEY ("VehicleId") REFERENCES retail.vehicles("Id") ON DELETE CASCADE;


--
-- TOC entry 4733 (class 2606 OID 24924)
-- Name: vehicles FK_vehicles_models_ModelId; Type: FK CONSTRAINT; Schema: retail; Owner: postgres
--

ALTER TABLE ONLY retail.vehicles
    ADD CONSTRAINT "FK_vehicles_models_ModelId" FOREIGN KEY ("ModelId") REFERENCES retail.models("Id") ON DELETE CASCADE;


-- Completed on 2024-06-13 03:58:42

--
-- PostgreSQL database dump complete
--

